package cn.itwangxiang.android.ui;

import cn.itwangxiang.android.R;
import cn.itwangxiang.android.widget.MyRadioGroup;
import cn.itwangxiang.android.widget.MyRadioGroup.OnCheckedChangeListener;
import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.Toast;

public class DemoRadio extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.demo_radio);
		
		MyRadioGroup mrg = (MyRadioGroup) findViewById(R.id.radioGroup1);
		
		mrg.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(MyRadioGroup group, int checkedId) {
				
				RadioButton rb = (RadioButton) findViewById(checkedId);
				Toast.makeText(DemoRadio.this, rb.getText().toString(), Toast.LENGTH_SHORT).show();
			}
		});
		
	}
}
